﻿using Games.Common;
using Games.Data;
using System;
using System.Collections.Generic;

namespace Games.Horse64
{
    class HorseRecord : GameRecords
    {
        public int StartX { get; set; }
        public int StartY { get; set; }
        public int EndX { get; set; }
        public int EndY { get; set; }
        public int Step { get; set; }

        public string Level
        {
            get
            {
                if(Step == 64)
                {
                    if(Math.Abs(StartX - EndX) + Math.Abs(StartY - EndY) == 3)
                    {
                        return "天才";
                    }
                    return "完美";
                }
                if(Step >= 62)
                {
                    return "杰出";
                }
                if(Step >= 58)
                {
                    return "优秀";
                }
                return "加油";
            }
        }

        public override Record Convert()
        {
            return new Record
            {
                Level = Level,
                Message = $"完成 {Step} 步，用时 {Utils.FormatTime((int)Duration)}",
                TimeString = CreateTime.ToString("yyyy-MM-dd HH:mm")
            };
        }
    }
}